﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoPartsSearch.Domain.Common;

namespace AutoPartsSearch.Domain.Entities
{
    public class ExtendedSeller : Seller
    {
        private DateTime _lastDateActivity;
        private DateTime? _lastOfferDate;

        public DateTime LastActivityDate
        {
            get { return Converter.ConvertToMoldTime(_lastDateActivity); }
            set { this._lastDateActivity = value; }
        }

        public int? DayOffersCount { get; set; }

        public int? TotalOffersCount { get; set; }

        public DateTime? LastOfferDate
        {
            get { return _lastOfferDate.HasValue ? Converter.ConvertToMoldTime(_lastOfferDate.Value) : _lastOfferDate; }
            set { this._lastOfferDate = value; }
        }

        public bool IsOnline
        {
            get { return LastActivityDate > Converter.ConvertToMoldTime(DateTime.Now).AddMinutes(-10); }
        }

        public bool IsGoingToExpire
        {
            get { return DateTime.Now.Date.AddDays(7) >= this.Expired; }
        }
    }
}
